---
title: Combobox
description: Combines a text input with a listbox, allowing users to filter a list of options to items matching a query.
component: true
kobalte:
    link: https://kobalte.dev/docs/core/components/combobox
    api: https://kobalte.dev/docs/core/components/combobox#api-reference
---

<ComponentPreview name="combobox-demo" />

## Installation

<Tabs defaultValue="cli">

<TabsList>
    <TabsTrigger value="cli">CLI</TabsTrigger>
    <TabsTrigger value="manual">Manual</TabsTrigger>
    <TabsIndicator class="bg-primary" />
</TabsList>

<TabsContent value="cli">

```bash
npx shadcn-solid@latest add combobox
```

</TabsContent>

<TabsContent value="manual">

<Steps>

<Step>Install the following dependencies:</Step>

```bash
npm install @kobalte/core
```

<Step>Copy and paste the following code into your project.</Step>

<ComponentSource name="combobox" />

<Step>Update the import paths to match your project setup.</Step>

</Steps>

</TabsContent>

</Tabs>

## Usage

```tsx
import {
    Combobox,
    ComboboxControl,
    ComboboxItem,
    ComboboxTrigger,
    ComboboxContent,
} from "@/components/ui/combobox"
import { createFilter } from "@kobalte/core"
import { createSignal } from "solid-js"
```

```tsx
const ALL_OPTIONS = ["Apple", "Banana", "Blueberry", "Grapes", "Pineapple"]

const filter = createFilter({ sensitivity: "base" })
const [options, setOptions] = createSignal(ALL_OPTIONS)
const onInputChange = (value: string) => {
    setOptions(ALL_OPTIONS.filter((option) => filter.contains(option, value)))
}
```

```tsx
<Combobox
    options={options()}
    onInputChange={onInputChange}
    itemComponent={(props) => (
        <ComboboxItem item={props.item}>{props.item.rawValue}</ComboboxItem>
    )}
>
    <ComboboxTrigger>
        <ComboboxInput />
    </ComboboxTrigger>
    <ComboboxContent />
</Combobox>
```
